﻿
using Dexter.Logger.Contracts;
using Dexter.Services;

namespace Dexter.Services.Implementation {
	public class EmailTemplateService : IEmailTemplateService {
		readonly IBlogTheme blogTheme;
		readonly ILogger logger;
		readonly IConfigurationService configurationService;
		readonly IUrlBuilderBase urlBuilderBase;
		readonly IThemeManager themeManager;

		/// <summary>
		/// Initializes a new instance of the <see cref="EmailTemplateService"/> class.
		/// </summary>
		/// <param name="logger">The logger.</param>
		/// <param name="configurationService">The configuration service.</param>
		/// <param name="urlBuilderBase">The URL builder base.</param>
		public EmailTemplateService ( ILogger logger , IConfigurationService configurationService , IUrlBuilderBase urlBuilderBase, IThemeManager themeManager ) {
			this.logger = logger;
			this.configurationService = configurationService;
			this.urlBuilderBase = urlBuilderBase;
			this.themeManager = themeManager;
		}

		/// <summary>
		/// 	Retrieve the template.
		/// </summary>
		/// <param name = "name">The name.</param>
		/// <returns>An instance of concrete implementaiton of <see cref = "IEmailTemplate" />. The result could be null if the template doesn't exist.</returns>
		public IEmailTemplate GetTemplate ( string name ) {
			return new EmailTemplate ( name, blogTheme, logger, configurationService, urlBuilderBase, themeManager );
		}
	}
}
